<template>
	<div class="ly-root page-chapter-detail">
		<h1>{{chapter.title}}</h1>
		<vue-markdown :source="chapter.text"></vue-markdown>
		<el-button  @click="back">返回</el-button>
	</div>
</template>

<script>
import * as web3CTR from '@/utils/web3-ctr'
import _ from 'lodash'
import VueMarkdown from 'vue-markdown'

export default {
	name: 'chapter-detail',
	components: {
		VueMarkdown
	},
	data(){
		return {
			addr: '',
			chapter:{
				text: '',
				title:''
			}
		}
	},
	created(){
		this.addr=this.$route.params.addr
		this.getDetail(this.addr)
	},
	mounted(){
	},
	methods:{
		getDetail(addr){
			web3CTR.getChapterDetail(addr).then((data)=>{
				Object.assign(this.chapter, data)
			})
		},
		back(){
			this.$router.back()
		}
	}
}
</script>
<style lang="stylus" scoped>
.page-add{
	padding: 20px;
	.chapter-title{
		width:100%;
		box-sizing border-box
		margin-bottom 15px
	}
	.chapter-text{
		width:100%;
		box-sizing border-box
		height 100px
		margin-bottom 15px
	}
}
</style>
